#!/bin/sh

set -e

if [ "${BASEDIR:=/}" = "/" ]; then
    BASEDIR=""
fi

case "$1" in
    install|upgrade)
	if [ -f $BASEDIR/var/lib/dpkg/info/system-data-keyboard-keytables.prerm ]; then
	rm -f $BASEDIR/var/lib/dpkg/info/system-data-keyboard-keytables.prerm
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_00
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_01
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_22
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_23
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_24
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_25
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_26
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_27
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_28
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_29
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2a
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2b
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2c
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2d
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2e
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_2f
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_30
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_31
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_32
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_33
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_34
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_35
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_36
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_37
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_38
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_39
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_3b
	rm -f $BASEDIR/usr/share/lib/keytables/type_101/layout_3e9

	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_00
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_01
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_02
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_03
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_04
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_05
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_06
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_07
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_08
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_09
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_0a
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_0c
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_0e
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_0f
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_10
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_100
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_101
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_102
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_103
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_104
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_105
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_106
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_107
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_108
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_109
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_10a
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_10b
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_10f
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_11
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_110
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_111
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_112
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_113
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_12
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_13
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_15
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_16
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_17
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_18
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_19
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_1a
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_1b
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_1c
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_1e
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_1f
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_20
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_21
	rm -f $BASEDIR/usr/share/lib/keytables/type_6/layout_23
	fi

	if [ ! -L $BASEDIR/usr/share/lib/keytables/type_4/layout_00 ]; then
        rm -f $BASEDIR/usr/share/lib/keytables/belgium_france
        rm -f $BASEDIR/usr/share/lib/keytables/canada
        rm -f $BASEDIR/usr/share/lib/keytables/canadian_french_5
        rm -f $BASEDIR/usr/share/lib/keytables/canadian_french_5_tbits5
        rm -f $BASEDIR/usr/share/lib/keytables/canadian_french_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/czech_5
        rm -f $BASEDIR/usr/share/lib/keytables/denmark
        rm -f $BASEDIR/usr/share/lib/keytables/denmark_5
        rm -f $BASEDIR/usr/share/lib/keytables/denmark_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/france_5
        rm -f $BASEDIR/usr/share/lib/keytables/france_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/germany
        rm -f $BASEDIR/usr/share/lib/keytables/germany_5
        rm -f $BASEDIR/usr/share/lib/keytables/germany_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/hungary_5
        rm -f $BASEDIR/usr/share/lib/keytables/italy
        rm -f $BASEDIR/usr/share/lib/keytables/italy_5
        rm -f $BASEDIR/usr/share/lib/keytables/italy_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/japan
        rm -f $BASEDIR/usr/share/lib/keytables/japan_5
        rm -f $BASEDIR/usr/share/lib/keytables/japan_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/korea
        rm -f $BASEDIR/usr/share/lib/keytables/korea_5
        rm -f $BASEDIR/usr/share/lib/keytables/korea_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/layout_00
        rm -f $BASEDIR/usr/share/lib/keytables/layout_01
        rm -f $BASEDIR/usr/share/lib/keytables/layout_02
        rm -f $BASEDIR/usr/share/lib/keytables/layout_03
        rm -f $BASEDIR/usr/share/lib/keytables/layout_04
        rm -f $BASEDIR/usr/share/lib/keytables/layout_05
        rm -f $BASEDIR/usr/share/lib/keytables/layout_06
        rm -f $BASEDIR/usr/share/lib/keytables/layout_07
        rm -f $BASEDIR/usr/share/lib/keytables/layout_08
        rm -f $BASEDIR/usr/share/lib/keytables/layout_09
        rm -f $BASEDIR/usr/share/lib/keytables/layout_0a
        rm -f $BASEDIR/usr/share/lib/keytables/layout_0b
        rm -f $BASEDIR/usr/share/lib/keytables/layout_0c
        rm -f $BASEDIR/usr/share/lib/keytables/layout_0d
        rm -f $BASEDIR/usr/share/lib/keytables/layout_0e
        rm -f $BASEDIR/usr/share/lib/keytables/layout_10
        rm -f $BASEDIR/usr/share/lib/keytables/layout_11
        rm -f $BASEDIR/usr/share/lib/keytables/layout_13
        rm -f $BASEDIR/usr/share/lib/keytables/layout_20
        rm -f $BASEDIR/usr/share/lib/keytables/layout_21
        rm -f $BASEDIR/usr/share/lib/keytables/layout_22
        rm -f $BASEDIR/usr/share/lib/keytables/layout_23
        rm -f $BASEDIR/usr/share/lib/keytables/layout_24
        rm -f $BASEDIR/usr/share/lib/keytables/layout_25
        rm -f $BASEDIR/usr/share/lib/keytables/layout_26
        rm -f $BASEDIR/usr/share/lib/keytables/layout_27
        rm -f $BASEDIR/usr/share/lib/keytables/layout_28
        rm -f $BASEDIR/usr/share/lib/keytables/layout_29
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2a
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2b
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2c
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2d
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2e
        rm -f $BASEDIR/usr/share/lib/keytables/layout_2f
        rm -f $BASEDIR/usr/share/lib/keytables/layout_30
        rm -f $BASEDIR/usr/share/lib/keytables/layout_31
        rm -f $BASEDIR/usr/share/lib/keytables/layout_32
        rm -f $BASEDIR/usr/share/lib/keytables/layout_33
        rm -f $BASEDIR/usr/share/lib/keytables/layout_34
        rm -f $BASEDIR/usr/share/lib/keytables/layout_35
        rm -f $BASEDIR/usr/share/lib/keytables/layout_36
        rm -f $BASEDIR/usr/share/lib/keytables/layout_3f
        rm -f $BASEDIR/usr/share/lib/keytables/layout_50
        rm -f $BASEDIR/usr/share/lib/keytables/layout_51
        rm -f $BASEDIR/usr/share/lib/keytables/layout_52
        rm -f $BASEDIR/usr/share/lib/keytables/layout_53
        rm -f $BASEDIR/usr/share/lib/keytables/layout_54
        rm -f $BASEDIR/usr/share/lib/keytables/layout_55
        rm -f $BASEDIR/usr/share/lib/keytables/layout_56
        rm -f $BASEDIR/usr/share/lib/keytables/layout_57
        rm -f $BASEDIR/usr/share/lib/keytables/layout_58
        rm -f $BASEDIR/usr/share/lib/keytables/layout_59
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5a
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5b
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5c
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5d
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5e
        rm -f $BASEDIR/usr/share/lib/keytables/layout_5f
        rm -f $BASEDIR/usr/share/lib/keytables/layout_60
        rm -f $BASEDIR/usr/share/lib/keytables/layout_61
        rm -f $BASEDIR/usr/share/lib/keytables/netherlands
        rm -f $BASEDIR/usr/share/lib/keytables/netherlands_5
        rm -f $BASEDIR/usr/share/lib/keytables/netherlands_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/norway
        rm -f $BASEDIR/usr/share/lib/keytables/norway_5
        rm -f $BASEDIR/usr/share/lib/keytables/norway_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/poland_5
        rm -f $BASEDIR/usr/share/lib/keytables/portugal
        rm -f $BASEDIR/usr/share/lib/keytables/portugal_5
        rm -f $BASEDIR/usr/share/lib/keytables/portugal_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/reset
        rm -f $BASEDIR/usr/share/lib/keytables/russia_5
        rm -f $BASEDIR/usr/share/lib/keytables/spain_5
        rm -f $BASEDIR/usr/share/lib/keytables/spain_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/spain_latin_america
        rm -f $BASEDIR/usr/share/lib/keytables/sweden_5
        rm -f $BASEDIR/usr/share/lib/keytables/sweden_finland
        rm -f $BASEDIR/usr/share/lib/keytables/sweden_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_french
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_french_5
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_french_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_german
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_german_5
        rm -f $BASEDIR/usr/share/lib/keytables/swiss_german_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/traditional_chinese
        rm -f $BASEDIR/usr/share/lib/keytables/traditional_chinese_5
        rm -f $BASEDIR/usr/share/lib/keytables/traditional_chinese_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_00
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_01
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_02
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_03
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_04
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_05
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_06
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_07
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_08
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_09
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_0a
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_0b
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_0c
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_0d
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_0e
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_10
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_11
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_13
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_20
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_21
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_22
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_23
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_24
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_25
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_26
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_27
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_28
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_29
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2a
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2b
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2c
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2d
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2e
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_2f
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_30
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_31
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_32
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_33
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_34
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_35
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_36
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_3f
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_50
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_51
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_52
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_53
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_54
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_55
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_56
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_57
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_58
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_59
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5a
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5b
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5c
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5d
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5e
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_5f
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_60
        rm -f $BASEDIR/usr/share/lib/keytables/type_4/layout_61
        rm -f $BASEDIR/usr/share/lib/keytables/uk
        rm -f $BASEDIR/usr/share/lib/keytables/uk_5
        rm -f $BASEDIR/usr/share/lib/keytables/uk_hobo
        rm -f $BASEDIR/usr/share/lib/keytables/us
        rm -f $BASEDIR/usr/share/lib/keytables/us101a_pc
        rm -f $BASEDIR/usr/share/lib/keytables/us_5
        rm -f $BASEDIR/usr/share/lib/keytables/us_hobo
	fi
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0
